Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a bi-directional WebSocket based RPC system #2797

Merged
merged 3 commits into from
Apr 12, 2024
Merged

Conversation

s-ludwig
Copy link
Member

@s-ludwig s-ludwig commented Apr 8, 2024

This implements a bi-directional alternative to the REST interface system, enabling HTTP based peer-to-peer communication over a unidirectional HTTP/TCP connection.

This implements a bi-directional alternative to the REST interface system, enabling HTTP based peer-to-peer communication over a unidirectional HTTP/TCP connection.
@Geod24
Copy link
Contributor

Geod24 commented Apr 9, 2024

FYI we had something similar, but not over websocket: https://github.com/Geod24/agora-server/blob/v0.x.x/source/agora/network/RPC.d
Can a server be registered with both ?

@s-ludwig
Copy link
Member Author

s-ludwig commented Apr 9, 2024

FYI we had something similar, but not over websocket: https://github.com/Geod24/agora-server/blob/v0.x.x/source/agora/network/RPC.d

Didn't know about that, also looks interesting, especially since that can probably be better tuned for performance for cases where that is important.

Can a server be registered with both ?

To avoid me talking nonsense, can you clarify what you mean with "both"? ;-)

@s-ludwig
Copy link
Member Author

Implemented vibe.web.auth support.

@s-ludwig s-ludwig requested a review from l-kramer April 12, 2024 09:30
@l-kramer l-kramer merged commit 471ab85 into master Apr 12, 2024
58 checks passed
@l-kramer l-kramer deleted the webrpc branch April 12, 2024 09:46
@Geod24
Copy link
Contributor

Geod24 commented Apr 12, 2024

To avoid me talking nonsense, can you clarify what you mean with "both"? ;-)

Our need was to expose an API. Starting with a REST API was super easy, because you just write an interface, the business-side implementation in the class, and voila. You have tons of tools available to deal with REST APIs, even from one's browser.
When we put things into production, we needed more performance, so we went with our TCP-based RPC approach. If I was to do it today, I'd look into HTTP/3. But we also wanted to be able to interact with the server in a more developer friendly way. So we ended up registering the business logic class on 0.0.0.0 with the RPC listener, and on 127.0.0.1 for the REST API, so we could still issue requests to it. That was extremely useful for dev speed.

@s-ludwig
Copy link
Member Author

Okay, yeah, that makes sense. I've also made sure to make most use cases work for REST and for the new module using the same interface definition. HTTP/2 and HTTP/3 would indeed be logical candidates to support as a replacement for or as an addition to WebSockets, but that of course is a big project just to get the protocol itself supported. I hope to get the HTTP/2 work integrated this year, which already shares a lot with HTTP/3. Hopefully the existing work on QUIC will then make it possible to get an HTTP/3 implementation relatively easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants